<template>
    <div id="OrdersTitle">
        <v-details :inputConfig="inputConfig" :detailData="inputData" :rules="rules" ref="input"></v-details>
    </div>
</template>

<script>
    import details from 'commons/Detail'
    import baseMixin from "@/mixins/BaseMixin";

    export default {
        props: {
            inputData: {
                type: Object,
            }
        },
        mixins: [baseMixin],
        name: "OrdersTitle",
        data() {
            return {
                addflag: true,
                whseidflag: false,
                rules: {
                    facility_id: [
                        {required: true, trigger: 'blur'},
                    ],
                    name: [
                        {required: true, trigger: 'blur'},
                    ],
                    system_id: [
                        {required: true, trigger: 'blur'},
                    ],
                    country_code: [
                        {required: true, trigger: 'blur'},
                    ],
                    enabled: [
                        {required: true, trigger: 'blur'},
                    ],
                    measure_code: [
                        {required: true, trigger: 'blur'},
                    ],
                    wgt_uom: [
                        {required: true, trigger: 'blur'},
                    ],
                    dimen_uom: [
                        {required: true, trigger: 'blur'},
                    ],
                    cube_uom: [
                        {required: true, trigger: 'blur'},
                    ],
                    curr_code: [
                        {required: true, trigger: 'blur'},
                    ],
                },
            }
        },
        computed: {
            inputConfig() {
                return [
                    [
                        {
                            type: "input",
                            label: this.$t('bill.wareHouse'),
                            props: "facility_id",
                            disabled: this.addflag
                        },
                        {
                            type: "input",
                            label: this.$t('common.desc'),
                            props: "name",
                            disabled: this.whseidflag
                        },
                    ],
                    [
                        {
                            type: "select",
                            label: "系统",
                            props: "system_id",
                            options: this.getOptions("getSelectCode/SYSTEM_ID/SYSTEM_DESC/BIC_SYSTEM/1=1"),
                            disabled: this.whseidflag
                        },
                        {
                            type: "select",
                            label: "ISO 国家/地区代码",
                            props: "country_code",
                            options: this.getOptions("codelkup/ISOCOUNTRY"),
                            disabled: this.whseidflag
                        },

                        {
                            type: "input",
                            label: this.$t('config.company'),
                            props: "def_corp_code",
                            disabled: this.whseidflag
                        },
                    ],
                    [
                        {
                            type: "select",
                            label: "已启用",
                            props: "enabled",
                            options: [
                                {code: 'Y', description: this.$t('code.yes')},
                                {code: 'N', description: this.$t('code.no')}
                            ],
                            disabled: this.whseidflag
                        },
                        {
                            type: "select",
                            label: "计量系统",
                            props: "measure_code",
                            options: this.getOptions("codelkup/MEASURESYS"),
                            disabled: this.whseidflag
                        },
                        {
                            type: "select",
                            label: "重量单位",
                            props: "wgt_uom",
                            options: this.getOptions("getSelectCode/UOM_CODE/UOM_DESC/BIC_UOM/UOM_TYPE_CODE in( 'G','N')"),
                            disabled: this.whseidflag
                        },
                        {
                            type: "select",
                            label: "维度单位",
                            props: "dimen_uom",
                            options: this.getOptions("getSelectCode/UOM_CODE/UOM_DESC/BIC_UOM/UOM_TYPE_CODE ='D'"),
                            disabled: this.whseidflag
                        },
                        {
                            type: "select",
                            label: "体积单位",
                            props: "cube_uom",
                            options: this.getOptions("getSelectCode/UOM_CODE/UOM_DESC/BIC_UOM/UOM_TYPE_CODE ='C'"),
                            disabled: this.whseidflag
                        },
                    ],
                    [
                        {
                            type: "select",
                            label: "货币",
                            props: "curr_code",
                            options: this.getOptions("queryCurrencyDetailCode"),
                            disabled: this.whseidflag
                        },
                        {
                            type: "select",
                            label: "税组",
                            props: "tax_group",
                            options: this.getOptions("queryTaxCode"),
                            disabled: this.whseidflag
                        },
                        {
                            type: "input",
                            label: "周围温度",
                            props: "amb_temperature",
                            disabled: this.whseidflag
                        },
                        {
                            type: "textarea",
                            label:  this.$t('app.remark'),
                            props: "facility_comment",
                            disabled: this.whseidflag
                        },
                    ],
                    [
                        {
                            type: "select",
                            label: "汇款",
                            props: "def_remit_code",
                            options: this.getOptions("queryRemitCode"),
                            disabled: this.whseidflag
                        },
                        {
                            type: "select",
                            label: "时区",
                            props: "time_zone_name",
                            options: this.getOptions("codelkup/TIMEZONE"),
                            disabled: this.whseidflag
                        },
                    ]
                ]
            }
        },
        methods: {},
        mounted() {
            if (this.$store.state.newFlag) {
                this.addflag = false;
            }
            if (this.$store.state.wms.toUpperCase().includes('WMWHSE')) {
                //仓库级
                this.addflag = this.whseidflag = true;
            }
        },
        watch: {},
        components: {
            'v-details': details
        }
    }
</script>

<style scoped>

</style>
